<?php

require_once('config.php');
require_once('errors/errors.php');

$path = "";
if (isset($_REQUEST['path']))
	$path = $_REQUEST['path'];

if (!isset($name_to_file_map[$path])) {
	renderError(array(type => 'noSuchPath', message => 'No such path:'.$path));
	exit;
}

$method = "";
if (isset($_REQUEST['method']))
	$method = $_REQUEST['method'];

include('controllers/'.$name_to_file_map[$path]);

$req = $_REQUEST;

processMethod($method);

